package com.ihmp.controller;

import java.util.ArrayList;
import java.util.List;

import org.apache.log4j.chainsaw.Main;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Component;

import com.ihmp.business.ProductInRoomService;
import com.ihmp.dao.HotelDAO;
import com.ihmp.model.Tproductinrooms;
import com.ihmp.model.Trooms;
@Component
public class test {

	/**
	 * @param args
	 */
	@Autowired
	private static ProductInRoomService productInRomService;

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		 ApplicationContext context = 
		            new ClassPathXmlApplicationContext("WEB-INF/spring-servlet.xml");

		 test p = context.getBean(test.class);
		   
		HotelDAO hotelBO = new HotelDAO();
		List<Trooms> rooms = new ArrayList<Trooms>();
//		Thotels hotel=  hotelBO.get(1);
//		System.out.println("Room ID: "+ hotel.getHotelName() );
//		List<Thotels> thotels = new ArrayList<Thotels>();
//		thotels = hotelBO.list();
//		for (Thotels thotel : thotels ) {
//			System.out.println("Room ID: "+ thotel.getHotelName() );
//		}
//		rooms = hotelBO.findByID(1).getRooms();
//		
//		for (Trooms room : rooms) {
//			System.out.println("Room ID: "+ room.getRoomId() );
//			
//		}
		
		List<Tproductinrooms> productList = productInRomService.listProductInRoom();
		for(int i = 0 ; i<productList.size();i++){
			System.out.println(productList.get(i).getProductInRoomName());
		}
		
//		ProductInRoomService productInRom = new ProductInRoomServiceImpl() ;
//		List<Tproductinrooms> tproductinrooms = new ArrayList<Tproductinrooms>();
//		 tproductinrooms = productInRom.listProductInRoom();
//		for (Tproductinrooms tproductinroom : tproductinrooms ) {
//			System.out.println("Room ID: "+ tproductinroom.getProductInRoomName() );
//		}
	}

}
